# 开始界面
from services.AccountServices import AccountServices

ac = AccountServices()


def start_menu():
    print()
    print("{}{}{}".format("*" * 17, "欢迎来到WoniuATM", "*" * 17))
    print("{}{}{}".format("*" * 17, " 请选择操作菜单 ", "*" * 17))
    print("{}{}{}".format("*" * 15, "1.注册 2.登录 3.退卡", "*" * 15))
    print()
    choose = input("请输入操作指令:")
    if choose == "1":
        ac.reg()
    elif choose == "2":
        ac.login()
    elif choose == "3":
        exit("欢迎下次登录!")
    else:
        print("请确定您的操作指令正确")
        start_menu()


# 操作界面
def main_menu():
    print()
    print("{}{}{}".format("*" * 21, "欢迎登录蜗牛银行", "*" * 21))
    print("{}{}{}".format("*" * 22, "请选择操作菜单", "*" * 22))
    print("{}{}{}".format("*" * 5, "1.查询 2.取款 3.存款 4.转账 5.流水 6. 返回 7.退卡", "*" * 5))
    print()
    choose = input("请输入操作指令:")
    if choose == "1":
        ac.query()
    elif choose == "2":
        ac.withdraw()
    elif choose == "3":
        ac.deposite()
    elif choose == "4":
        ac.transer()
    elif choose == "5":
        ac.history()
    elif choose == "6":
        start_menu()
    elif choose == "7":
        exit("欢迎下次登录!")
    else:
        print("操作指令不存在,请重试!")
        main_menu()


# 执行任务
if __name__ == "__main__":
    start_menu()
